<template>
  <div class="navtop">
    <div>
      <van-nav-bar
        title="标题"
        left-arrow
        left-text="返回"
        @click-left="onClickLeft"
      >
        <template #right>
          <van-icon
            name="wap-home-o"
            size="18"
            color="#fff"
            @click-right="onClickRight"
          />
        </template>
      </van-nav-bar>
    </div>
  </div>
</template>

<script>
import { Toast } from "vant";
export default {
  data() {
    return {
      active: 0,
    };
  },
  methods: {
    onClickLeft() {
      this.$router.back();
    },
    onClickRight() {
      //判断一下是否在首页
      //如果在就提示
      if (this.$route.path == "/home") {
        this.$toast("你已经在首页了");
      } else {
        this.$router.push("/home");
      }
    },
  },
};
</script>
 
<style lang = "less" scoped>
/deep/ .van-nav-bar__content {
  background-color: #003399;
  .van-nav-bar__left {
    /* margin-left: 0.08rem; */
    .van-nav-bar__text,
    .van-icon {
      color: #fff;
    }
  }
}
/* .navtop {
  margin-bottom: 0.2rem;
} */
</style>